package com.xzh.testDemo.service;

import com.xzh.spring.BeanPostProcessor;
import com.xzh.spring.Component;

//@Component
public class TestBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) {
        System.out.println("BeforeInitialization;;"+beanName);
        if (bean instanceof UserService){
            System.out.println("给UserService的bean进行初始化前处理");
        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) {
        System.out.println("AfterInitialization;;"+beanName);
        if (bean instanceof UserService){
            System.out.println("给UserService的bean进行初始化后-处理");
        }

        return bean;
    }
}
